﻿@{
    ViewBag.Title = "showUser";
    Layout = "~/Views/Shared/ShouYe.cshtml";
}
<link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/js/jquery.min.js"></script>
<script src="~/Scripts/js/bootstrap.min.js"></script>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<style>
     ul{border:0; margin:0; padding:0;}

#pagination-digg li{
border:0; margin:0; padding:0;
font-size:16px;
list-style:none;
margin-right:2px;
}
#pagination-digg a{
border:solid 1px #9aafe5;
margin-right:2px;
}

#pagination-digg .next a,
#pagination-digg .previous a {
font-weight:bold;
}

#pagination-digg a:link,
#pagination-digg a:visited {
color:#0e509e;
display:block;
float:left;
padding:3px 6px;
text-decoration:none;
}
#pagination-digg a:hover{
border:solid 1px #0e509e
}
    .btn12 {
        width: 143px;
        height: 40px;
        border-radius:5px;
        background: no-repeat left top;
        background-image: url('../../images/bg12.jpg');
        color: #FFF;
    }
</style>
<div class="col-lg-12" style="margin-top:10px;">
    <div class="col-lg-12">
        <input id="Button1" class="btn btn-warning btn-block" onclick="tianjia()" type="button" value="添加新用户" />
        <table class="tab-content table table-bordered table-striped table-responsive" >
            <thead>
                <tr>
    <th colspan="11" style="text-align:center"><h3>用户管理</h3></th>
</tr>
                <tr>
                    <th>用户编号</th>
                    <th>用户登录名</th>
                    <th>用户真实姓名</th>
                    <th>用户职位</th>
                    <th>用户性别</th>
                    <th>用户年龄</th>
                    <th>用户状态</th>
                    <th>用户手机号</th>
                    <th>用户邮箱</th>
                    <th>账户状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in ViewBag.userShow)
                {
                    <tr>
                        <td>@item.userID</td>
                        <td>@item.userName</td>
                        <td>@item.userRealname</td>
                        @foreach (var role in ViewBag.rolelist)
                        {
                            if (@role.RoleId == @item.RoleId)
                            { 
                                <td>@role.RoleName</td>
                            }
                            else {
                                continue;
                            }
                        }
                        <td>@item.userSex</td>
                        <td>@item.userAge</td>
                        <td>@item.userState</td>
                        <td>@item.userPhone</td>
                        <td>@item.userEmail</td>

                        
    @if (@item.userDel == 0)
    {
                 <td>冻结  | <a href="/Home/updUser?userdel=1&&usershan=@item.userShan&&userid=@item.userID">解冻</a> </td>
                <td><a href="/Home/updUser?userdel=@item.userDel&&usershan=1&&userid=@item.userID">删除</a>  |  <a href="/Home/updataUser?userid=@item.userID">修改</a>
                   
                        </td>
                                                                                                                                                                        
    }
    @if (@item.userDel == 1)
    {
        <td>正常 | <a href="/Home/updUser?userdel=0&&usershan=@item.userShan&&userid=@item.userID">冻结</a>  </td>
        <td> <a href="/Home/updUser?userdel=@item.userDel&&usershan=1&&userid=@item.userID" >删除</a> |  <a href="/Home/updataUser?userid=@item.userID">修改</a>
                       </td>
    }
                      
                    </tr>
                }
            </tbody>
        </table>
    </div>
        <div class="col-lg-12" style="padding-right:10px;">
            <p>
               
                @{
                    int count = @ViewBag.zongCount;
                    int size = @ViewBag.userSize;
                    int page = (count + size - 1) / size;
                    <input class="btn12" onmouseover="this.style.backgroundPosition='left -40px'" onmouseout="this.style.backgroundPosition='left top'" onclick="chaxun()" type="button" value="用户名查询" style="float:right;padding-right:10px;margin-top:8px;width:100px;height:30px;" />                    <input type="text" id="username" style="float:right;margin-right:5px;margin-left:10px;margin-top:14px;border-width:1px;border-color:black" onmouseover="this.style.borderColor='black';this.style.backgroundColor='plum'" onmouseout="this.style.borderColor='black';this.style.backgroundColor='#ffffff'" />
                    <ul id="pagination-digg">
                        <li style="float:right;"><a href="/Home/showUser?pageIndex=@ViewBag.weiyYe ">尾页</a></li>
                        @for (int i = page; i >= 1; i--)
                        {
                            <li style="float:right;"><a href="/Home/showUser?pageIndex=@i"> @i </a></li>
                        }
                        <li style="float:right;"><a href="/Home/showUser?pageIndex=1">首页</a></li>
                    </ul>
                }
                
               
            </p>
        </div>
    </div>
<script>
    function chaxun()
    {
        var name = $("#username").val();
        location.href = "/Home/showUser?userName=" + name;
    }
    function tianjia()
    {
        location.href = "/Home/zhuce";
    }
</script>

